<template>
  <button class="block" v-hasPermission:[permissions]="'add'">新增权限</button>

  <button style="margin-top: 20px" @click="changePermission">
    点击我改变button传入权限
  </button>
  <p>我现在的权限有： {{ permissions.join("") }}</p>
</template>
<script setup>
import { ref, computed } from "vue";
let isAdd = ref(true);
const changePermission = () => {
  isAdd.value = !isAdd.value;
};
const permissions = computed(() => (isAdd.value ? ["add"] : []));
</script>
<style>
.hide {
  display: none;
}
.block {
  display: block;
}
</style>
